/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tests;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
import lispinterpreter.*;

/**
 *
 * @author JuanFer
 */
public class LispParserTest {

    public LispParserTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }

    /**
     * Test of parse method, of class LispParser.
     */
    @Test
    public void testParse() throws Exception {
        System.out.println("parse");
        String list = "(+ 2)";
        boolean expResult = true;
        LispList result = LispParser.parse(list);
        assertEquals(expResult, result.isSimple());
        // TODO review the generated test code and remove the default call to fail.
    }

    /**
     * Test of hasParenthesis method, of class LispParser.
     */
    @Test
    public void testHasParenthesis() {
        System.out.println("hasParenthesis");
        String list = "asdf;l";
        boolean expResult = false;
        boolean result = LispParser.hasParenthesis(list);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
    }



    /**
     * Test of parenthesisCheck method, of class LispParser.
     */
    @Test
    public void testParenthesisCheck() {
        System.out.println("parenthesisCheck");
        String list = "(+ 2(* 2 2) 2)";
        boolean expResult = true;
        boolean result = LispParser.parenthesisCheck(list);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
    }




    /**
     * Test of formulaIsSimple method, of class LispParser.
     */
    @Test
    public void testFormulaIsSimple() {
        System.out.println("formulaIsSimple");
        String chain = "(+ 2 (* 2 ) )";
        LispParser instance = new LispParser();
        boolean expResult = false;
        boolean result = instance.formulaIsSimple(chain);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
    }

    /**
     * Test of rightPlacedParenthesisSimple method, of class LispParser.
     */
    @Test
    public void testRightPlacedParenthesisSimple() {
        System.out.println("rightPlacedParenthesisSimple");
        String chain = "(+ 2 2 2 a)";
        LispParser instance = new LispParser();
        boolean expResult = true;
        boolean result = instance.rightPlacedParenthesisSimple(chain);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
    }

    /**
     * Test of twoParenthesisSimple method, of class LispParser.
     */
    @Test
    public void testTwoParenthesisSimple() {
        System.out.println("twoParenthesisSimple");
        String chain = "((";
        LispParser instance = new LispParser();
        boolean expResult = true;
        boolean result = instance.twoParenthesisSimple(chain);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
    }





    /**
     * Test of atomInstance method, of class LispParser.
     */
    @Test
    public void testAtomInstance() {
        System.out.println("atomInstance");
        String atom = "true";
        LispAtom expResult = new LispAtom(true);
        LispAtom result = (LispAtom) LispParser.atomInstance(atom);
        assertEquals(expResult.isAtom, result.isAtom);
        // TODO review the generated test code and remove the default call to fail.
    }

}